Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 494 - Kindergarten Counting Game / p494.cpp
blob5fea54ca2519bd6072bf9446ece17af877b79b72
1 #include <iostream>
2 #include <sstream>
3 #include <string>
5 using namespace std;
8 bool isVocal(const string &s){
9 string vocs = "aAeEiIoOuU";
10 for (int i=0; i<vocs.length(); i++){
11 if (s == vocs.substr(i, 1)){
12 return true;
15 return false;
18 bool isAlpha(const string &s){
19 for (int i=0; i<s.length(); i++){
20 if (!isalpha(s.at(i))){
21 return false;
24 return true;
27 string procesar(const string &s){
28 if (isVocal(s.substr(0,1))){
29 return (s + "ay");
30 }else{
31 return (s.substr(1, s.length()-1) + s.substr(0,1)+"ay");
36 int main(){
38 string entrada, temp;
39 int cuenta;
40 while ( getline(cin, entrada) ){
41 entrada += "\n";
42 temp = "";
43 cuenta = 0;
44 int len = entrada.length();
45 for (int i=0; i<len; i++){
46 if (!isAlpha(entrada.substr(i,1))){
47 if (temp.length() > 0){
48 //cout << procesar(temp);
49 cuenta++;
51 temp = "";
52 //cout << entrada[i];
53 }else{
54 temp += entrada[i];
57 cout << cuenta << endl;